﻿using System;
using DotNetRepository.Tools;

namespace DotNetRepository
{
    public struct EntityID
    {
        private Guid _id;
        public Guid Value
        {
            get
            {
                if (_id == Guid.Empty)
                    _id = SequentialGuidGen.Instance.NewGuid();
                return _id;
            }
            set
            {
                if (_id == Guid.Empty)
                    _id = value;
            }
        }

        public DateTime Created
        {
            get { return SequentialGuidGen.GetTimeStamp(Value); }
        }
    }
}
